<?php
	
	
			$id = $_GET['idbpos'];
			$cItems = new CItems;
			
			//**************************************
			// Lay ra chi tiet cua mot item
			//**************************************
			
			$notification = "";
			
			if(isset($_GET['notification']))			
			{
				$notification = constant($_GET['notification']);
			}
				

			$item = $cItems->CItemsDetail($id);
			
			$listType='<select name="lTypes" id="input3">';
			
			
			$type = new CType;
			
					
			
			$category = new CCategory;
			$arrCategory = $category -> CCategoryList();
			
			if(is_array($arrCategory))
			{
				foreach ($arrCategory as $key => $valueCategory)
				{
					
					
					$arrType = $type -> CTypeListOfCategory($valueCategory['id']);
					if(is_array($arrType))
					{
						$listType .='<option style="background:#999999" value="-1" > Category:'.$valueCategory['name'].' </option>';	
						foreach ($arrType as $key1 => $valueType)
						{
							if($item['id_type'] == $valueType['id'])
							{
								//$listType .='<option selected="selected" value="'.$valueType['id'].'" title="'.$valueType['description'].'"> --- '.$valueType['name'].' </option>';
								$listType .='<option selected="selected" value="'.$valueType['id'].'" > --- '.$valueType['name'].' </option>';
							}
							else
							{
								//$listType .='<option value="'.$valueType['id'].'" title="'.$valueType['description'].'"> --- '.$valueType['name'].' </option>';
								$listType .='<option value="'.$valueType['id'].'" > --- '.$valueType['name'].' </option>';
							}	
						}		
					}				
				}
			}		
			
			
			$listType .='</select>';
			
			if($item['status_price'] == 1)
			{
				$listStatusPrice ='<select name="lPrice" id="input4">
										    <option value="1" selected="selected"> VND </option>
										    <option value="2"> USD </option>
										</select>';
			}
			else
			{
				$listStatusPrice ='<select name="lPrice" id="input4">
										    <option value="1" > VND </option>
										    <option value="2" selected="selected"> USD </option>
										</select>';
			}		
			
			
			$rdbtnStatus = "";
			
			if($item['status'] ==1)
			{
				$rdbtnStatus ='  <label><input type="radio" name="rdbtn_status" value="1" checked="checked" >Active</label>
								<br>
								<label><input type="radio" name="rdbtn_status" value="0" > Inactive </label>
								';
			}
			else
			{
				$rdbtnStatus =' <label><input type="radio" name="rdbtn_status" value="1"  >Active </label>
							<br>
							<label><input type="radio" name="rdbtn_status" value="0" checked="checked">Inactive </label>
							';
			}
			
			
			
			$tf_quantities = $item['status_sell'];
			if($item['status_sell']  ==-1)
			{
				$tf_quantities = "remaining";
			}
			
			
			
			//*********************************
			//ket thuc tao list category 
			//*********************************
			
			$mainContent = '<form action="processItems.php" method="post" name="form1" ENCTYPE="multipart/form-data">
							<div id="content2">
							<span style="font-size:10px;color:#FF0000;font-weight:bold;font-family:Arial, Helvetica, sans-serif">'.$notification.'</span>
							
							<script type="text/javascript">
							bkLib.onDomLoaded(function() {
							new nicEditor({maxHeight : 200}).panelInstance("area");
							});
							</script>
								<table border="0" width="90%" style="position:relative" align = "center" >
                            	<tr>
                                	<td colspan="2" align="left" valign="middle" height="50px"> 
										 <img src="images/profile.png" style="float:left" border="0"/>
										 <span class="mystyle1">Edit of Items </span>		 
										 <input type="hidden" name="showItems" value="'.$item['id'].'">
									</td>
                                </tr>
								<tr>
									<td><span class="mystyle2">Catergory <span>
									</td>
                                	<td>'.$listType.'
                                    </td>
                                </tr>
								
								<tr>
                                	<td><span class="mystyle2">Name <span>
                                    </td>
                                    <td>
                                    	<input id="input3" type="text" name="tf_name" value="'.$item['name'].'" >
                                    </td>
                                </tr>
								
								<tr valign="top">
                                	<td><span class="mystyle2">Price <span>
                                    </td>
                                    <td>
                                    	<input id="input3" type="text" name="tf_price" value="'.$item['price'].'" > 
										'.$listStatusPrice.'
                                    </td>
                                </tr>
								
								<tr valign="top">
                                	<td><span class="mystyle2">Picture <span>
                                    </td>
                                    <td>
                                    	
										<img src="../resources/'.$item['picture'].'" width="160px" height="120px" border="0">
										<br>
										<input name="tf_filePicture" type="file" size="47px" "/>									
										<br> &nbsp;
                                    </td>
                                </tr>
								
								
								<tr>
                                	<td valign="top"><span class="mystyle2">Description <span>
                                    </td>
                                    <td>
                                    	<textarea cols="50" rows="6" id="area"  name="tf_description" >'.$item['description'].'</textarea>
                                    </td>
                                </tr>
                                
         						
								<tr valign="top">
                                	<td><span class="mystyle2">Manufacture <span>
                                    </td>
                                    <td>
                                    	<input name="tf_manufacture" type="text" id="input3" value="'.$item['manufacture'].'"/>									
                                    </td>
                                </tr>
								
								
								<tr valign="top">
                                	<td><span class="mystyle2">Code <span>
                                    </td>
                                    <td>
                                    	<input name="tf_idItems" type="text" id="input3" value="'.$item['id_items'].'"/>									
                                    </td>
                                </tr>
								
								<tr valign="top" style="display:none">
                                	<td><span class="mystyle2">Thumbnail <span>
                                    </td>
                                    <td>
                                    	<input name="tf_fileThumbnail" type="file" size="47px" value="'.$item['thumbnail'].'"/>									
										<br>
										<img src="../resources/'.$item['thumbnail'].'" width="160px" height="120px" border="0">
                                    </td>
                                </tr>
								
								<tr valign="top">
                                	<td><span class="mystyle2">Status<span>
                                    </td>
                                    <td>
                                    	'.$rdbtnStatus .'
                                    </td>
                                </tr>
								
								<tr valign="middle">
                                	<td><span class="mystyle2">Quantities<span>
                                    </td>
                                    <td>
                                    	<input type="text" id="input3" name="tf_status_sell" value="'.$tf_quantities.'" />
                                    </td>
                                </tr>
								
								<tr align="center">
                                	<td colspan="2" height="50px">
                                    	<input id="input2"  type="submit" name="btn_ok" value="  OK  ">
                                        <input id="input2" name="btn_cancel" type="submit" value="  Cancel  " >
                                    </td>
                                </tr>
								</table>
							</div>
							<input type="hidden" name="hItemAction" value="edi">	
							
							</form>';
?>